<template>
	<view class="mar-10">
		<view class="tabs">
			<view v-for="(item,i) in list" :key='i' class="tab" @click="handleTab(i)">
				<view class="bar" :class="current==i?'active':''">{{item.name}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			list: {
				type: Array,
				default: () => {
					return []
				}
			},
			current: {
				type: Number,
				default: 0
			}
		},
		methods: {
			handleTab(i) {
				this.$emit('click', i)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.tabs {
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 18px;
		line-height: 30px;
		height: 30px;
		.tab {
			width: 30%;
			background-color: rgb(237, 253, 255);
			border-radius: 45px;

			.bar {
				text-align: center;
				border-radius: 45px;
			}

			.active {
				background-color: rgb(64, 207, 230);
				color: white;
			}
		}

	}
</style>